package com.geostar.constructionland.statistics.service.handler;

import lombok.extern.slf4j.Slf4j;

import java.util.function.Supplier;

/**
 * @Author makoto_zhu
 * @Date 2020-10-29 11:48:17
 * @Description
 **/
@Slf4j
public abstract class RequestHandler {

    private RequestHandler next;

    protected RequestHandler addHandler(Supplier<RequestHandler> next) {
        this.next = next.get();
        return this.next;
    }
    /**
     * Request handler.
     */
    public void handleRequest(Request req) {
        if (next != null) {
            next.handleRequest(req);
        }
    }

}
